<template>
    <div>
        <yd-cell-group>
            <yd-cell-item>
                <span slot="left">标题：</span>
                <input slot="right" type="text" placeholder="请输入标题" v-model="title">
            </yd-cell-item>
            <yd-cell-item>
                <yd-textarea slot="right" placeholder="请输入详细描述" maxlength="500" v-model="content"></yd-textarea>
            </yd-cell-item>
        </yd-cell-group>
        <yd-cell-group title="问题处理">
            <yd-cell-item arrow type="label">
                <span slot="left">处理部门：</span>
                <select slot="right" name="dept" v-model="dept">
                    <option value="">请选择部门</option>
                    <option value="人力资源部">人力</option>
                    <option value="工会">工会</option>
                    <option value="总务">总务</option>
                </select>
            </yd-cell-item>
        </yd-cell-group>
        <yd-button :type="title && content ? 'primary' : 'disabled'" size="large" @click.native="submitProblem">提交</yd-button>
    </div>
</template>

<script>
module.exports = {
    created () {
        this.$store.commit('webar', {
            show: 'tabs',
            tabs: [
                {name: '投诉', label: '我的'},
                {name: '投诉公示', label: '公示'},
                {name: '新的投诉', label: '新的'}
            ]
        })
    },
    data () {
        return {
            title: '',
            content: '',
            dept: ''
        }
    },
    methods: {
        submitProblem () {
            this.$store.dispatch('newComplaints',
                {channel: 1, title: this.title, content: this.content, dept: this.dept, resolve: (data) => {
                    this.$router.push({name:'投诉'})
                }})
        }
    }
}
</script>

<style scoped>
</style>